package net.googlecode.exigenlab.task3;

import net.googlecode.exigenlab.task3.personal.Boss;
import net.googlecode.exigenlab.task3.personal.Employee;
import net.googlecode.exigenlab.task3.personal.Manager;
import net.googlecode.exigenlab.task3.salary.SalaryCalculator;

/**
 * Class for testing task#3. Create instances of all realized classes and check
 * their work.
 * 
 * @author Poddybniak Petr <a href="mailto:PPoddybniak@gmail.com">Poddybniak
 *         Petr</a>
 * @since 28.03.2011
 */
public class SalaryApp {
	/**
	 * Default constructor.
	 * 
	 */
	public SalaryApp() {
		super();
	}

	/**
	 * Calculate workers salary.
	 * 
	 * @param args
	 *            arguments of command line
	 */
	public static void main(String[] args) {
		SalaryApp sal = new SalaryApp();
		SalaryCalculator cal = new SalaryCalculator();

		cal.getSalary(sal.createEmployeeWithBonus());
		cal.getSalary(sal.createEmployeeWithoutBonus());
		cal.getSalary(sal.createManagerWithBonus());
		cal.getSalary(sal.createManagerWithoutBonus());
		cal.getSalary(sal.createBoss());

	}

	/**
	 * Create manager without bonus.
	 * 
	 * @return Manager without bonus.
	 */
	public Manager createManagerWithoutBonus() {
		Manager manager = new Manager("Ivan", "Ivanov");
		manager.setAge(30);
		manager.setPerHour(true);
		manager.setBonus(false);
		manager.setRate(25);

		return manager;
	}

	/**
	 * Create manager with bonus.
	 * 
	 * @return Manager with bonus.
	 */
	public Manager createManagerWithBonus() {
		Manager manager = new Manager("Petr", "Petrov");
		manager.setAge(35);
		manager.setBonus(true);
		manager.setBonusAmount(1000);
		manager.setPerHour(false);
		manager.setRate(5000);

		return manager;
	}

	/**
	 * Create employee with bonus.
	 * 
	 * @return Employee with bonus.
	 */
	public Employee createEmployeeWithBonus() {
		Employee employee = new Employee("Semen", "Semenov");
		employee.setAge(55);
		employee.setBonus(true);
		employee.setBonusAmount(1500);
		employee.setPerHour(true);
		employee.setRate(8);

		return employee;
	}

	/**
	 * Create employee without bonus.
	 * 
	 * @return Employee without bonus.
	 */
	public Employee createEmployeeWithoutBonus() {
		Employee employee = new Employee("Sergey", "Sergeev");
		employee.setAge(45);
		employee.setBonus(false);
		employee.setPerHour(false);
		employee.setExperience(15);
		employee.setRate(200);

		return employee;
	}

	/**
	 * Create boss.
	 * 
	 * @return Boss with bonus.
	 */
	public Boss createBoss() {
		Boss boss = new Boss("Pankrat", "Pankratovich");
		boss.setAge(55);
		boss.setRate(35);
		boss.setBonusAmount(2000);

		return boss;
	}
}
